
public class TwinPrime {

	public boolean prime(int n) {
		for (int j = 2; j <= n / 2; j++) {
			int x = n % j;
			if (x == 0) {
				return false;
			}
		}
		return true;
	}

	public static void main(String[] args) {
		TwinPrime t = new TwinPrime();
		for (int i = 2; i < 1000; i++) {
			if (t.prime(i)) {
				if (t.prime(i + 2)) {
					System.out.println(i + "," + (i + 2));
				}
			}
		}
	}

	/*
	 * public static void main(String[] args) { int temp=0; int[] data = new
	 * int[250]; for(int i = 2; i < 1000; i++) { boolean flag = true ; for(int j =
	 * 2;j <=i/2; j++) { int x = i % j; if(x == 0) { flag = false ; } } if(flag) {
	 * //System.out.println(i);
	 * 
	 * data[temp] = i; temp += 1;
	 * 
	 * } } for (int n = 0; n < temp; n++) { int x = data[n + 1] - data[n]; if (x ==
	 * 2) { System.out.println(data[n] + " , " + data[n + 1]); } } }
	 */
}